{% set scope = 'scopes_album' %}
{% extends "shadow/common.twig" %}
{% block style %}
<style type="text/css">
th {
    text-align: center;
    vertical-align: middle;
}
td {
    text-align: center;
    vertical-align: middle;
}
.webuploader-container {
    position: relative;
}
.webuploader-element-invisible {
    position: absolute !important;
    clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
    clip: rect(1px,1px,1px,1px);
}
.webuploader-pick {
    position: relative;
    display: inline-block;
    cursor: pointer;
    background: #00b7ee;
    padding: 10px 15px;
    color: #fff;
    text-align: center;
    border-radius: 3px;
    overflow: hidden;
}
.webuploader-pick-hover {
    background: #00a2d4;
}

.webuploader-pick-disable {
    opacity: 0.6;
    pointer-events:none;
}
</style>
{% endblock %}
{% block body %}
<div id="page-wrapper" style="min-height: 334px;">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">专辑管理</h1>
        </div>
    </div>
    <div class="row">
        <button class="btn btn-primary btn-lg add_album" data-token="{{ token }}">
            新增专辑
        </button>
        <div class="panel-body">
            <div class="modal fade" id="album" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                            <h4 class="modal-title" id="myModalLabel">新增专辑</h4>
                        </div>
                        <form method="post" action="/shadow/photo/album">
                            <div class="modal-body">
                                <div class="form-group">
                                    <label>专辑名称：</label>
                                    <input class="form-control" name="title" type="text">
                                    <label>描述：</label>
                                    <textarea name="description" class="form-control"></textarea>
                                    <label>类型：</label>
                                    <select class="form-control" name="phototype">
                                        {% for type in types %}
                                            <option value="{{ type.vt_id }}">{{ type.title }}</option>
                                        {% endfor %}
                                    </select>
                                    <label>封面图</label>
                                    <div class="btns">
                                        <div id="picker">选择文件</div>
                                    </div>
                                    <label>标签：</label>
                                    {% set i = 1 %}
                                    {% for tag in tags %}
                                        <input name="tag[{{ i }}]" type="checkbox" value="{{ tag.vt_id }}">{{ tag.vt_id }}
                                    {% set i = i + 1 %}
                                    {% endfor %}
                                    <input type="hidden" name="type" value="add_album">
                                    <input type="hidden" name="cover" value="">
                                    <input type="hidden" name="id" value="">
                                    <input type="hidden" name="_token" value="{{ token }}">
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    专辑列表
                </div>
                <div class="panel-body">
                    <div class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                        <div class="row">
                            <div class="col-sm-12">
                                <table class="table table-striped table-bordered table-hover dataTable no-footer dtr-inline" style="width: 100%;">
                                    <thead>
                                        <tr role="row">
                                            <th>编号</th>
                                            <th>名称</th>
                                            <th>描述</th>
                                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {% for album in albums %}
                                        <tr class="gradeA odd">
                                            <td>{{ album.pa_id }}</td>
                                            <td>{{ album.title }}</td>
                                            <td>{{ album.description }}</td>
                                            <td>
                                                {% if album.status == 'draft' %}
                                                    待审核
                                                {% elseif album.status == 'show' %}
                                                    使用中
                                                {% else %}
                                                    已删除
                                                {% endif %}
                                            </td>
                                            <th>
                                                {% if album.status == 'draft' %}
                                                    <button type="button" class="btn btn-success btn-edit" data-id="{{ album.pa_id }}" data-title="{{ album.title }}">编辑</button>&nbsp;
                                                    <button type="button" class="btn btn-success btn-fabu" data-id="{{ album.pa_id }}" data-title="{{ album.title }}">发布</button>&nbsp;
                                                {% elseif album.status == 'show' %}
                                                    <button type="button" class="btn btn-warning btn-jinyong" data-id="{{ album.pa_id }}">下架</button>&nbsp;
                                                {% endif %}
                                                <a target="_blank" href="/shadow/photo/detail/{{ album.pa_id }}">详情</a>
                                            </th>
                                        </tr>
                                        {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
{% block script %}
    <script type="text/javascript" src="http://cdn.staticfile.org/webuploader/0.1.0/webuploader.min.js"></script>
    <script type="text/javascript">
    
    </script>
    {% if debug == true %}
        <script type="text/javascript" src="//s.imcn.vip/lib/develop/a_common.js"></script>
        <script type="text/javascript" src="//s.imcn.vip/lib/develop/album.js"></script>
    {% endif %}
{% endblock %}
